<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";

const router = useRouter();
const route = useRoute();

const success = ref(true);

onMounted(() => {
  success.value = route.query.success === "true";
});

const goBack = () => {
  router.back();
};
</script>
<template>
  <div class="bg-white w-full">
    <div v-if="success">
      <a-result
        status="success"
        title="订单支付宝成功！"
        sub-title="订单号: 2017182818828182881 订单生效需要大约 1-5 分钟, 请耐心等待."
      >
        <template #extra>
          <a-button key="console" type="primary" @click="goBack">
            返回控制台
          </a-button>
          <a-button key="buy" @click="goBack">再次购买</a-button>
        </template>
      </a-result>
    </div>
    <div v-else>
      <a-result status="warning" title="订单交易异常">
        <template #extra>
          <a-button key="console" type="primary" @click="goBack">
            返回控制台
          </a-button>
        </template>
      </a-result>
    </div>
  </div>
</template>
<style lang="scss" scoped></style>
